<?php
class TTemplate implements TTemplate_Interface, TPlugin_Interface, TPlugin_Last_Interface, TPlugin_Self_Interface
{
	public $priority = TTemplateConf::PRIORITY;
	private $dt = array();
	private $tmp;

	public function pry(){
		if(isset($this->priority)){
			return $this->priority;
		}else{
			return self::PRIORITY;
		}
	}

	public function act(){
		$s = TInstances::getSelf();
		$tmp = $s->offsetGet(__CLASS__)->getTemplate();
		if(strlen($tmp) == 0) return;

		TTemplateConf::init();

		$path = TTemplateConf_DIR.DS.$tmp.TTemplateConf_EXTENSION;
		if(!is_readable($path)) return;

		$actData = $this->getData();
		include($path);
	}

	public function etc(){}
	public function setData($k, $d){$this->dt[$k] = $d;}
	public function getData(){return $this->dt;}
	public function setTemplate($t){$this->tmp = $t;}
	public function getTemplate(){return $this->tmp;}
}
